package com.ejd.access.bean;

import java.util.ArrayList;

import java.util.List;

import com.ejd.web.bo.BaseEntity;

@SuppressWarnings("serial")
public class Station extends BaseEntity {	
        
	private String code;
        
	private String description;
	
	private Company company;
	
	private boolean assigned;
	
	private boolean online;
	
	//when validate, has error 
	private boolean validateError;
	
	private List<String> resourcesId = new ArrayList<String>();
	
	private List<Resource> resources;
	
	//just for query
	private List<Station> stations;
	
	public List<Station> getStations() {
		return stations;
	}

	public void setStations(List<Station> stations) {
		this.stations = stations;
	}

	public String getResourcesString() {
		StringBuffer sb = new StringBuffer();
		for (Resource resource : resources) {
			if (resource.isAssigned()) {
				sb.append(resource.getName() + ",");
			}
		}
		if (sb.length() > 0) {
			return sb.substring(0, sb.length() - 1);
		}
		return sb.toString();
	}
	
	public boolean isValidateError() {
		return validateError;
	}

	public void setValidateError(boolean validateError) {
		this.validateError = validateError;
	}

	public List<Resource> getResources() {
		return resources;
	}

	public void setResources(List<Resource> resources) {
		this.resources = resources;
	}

	public List<String> getResourcesId() {
		return resourcesId;
	}

	public void setResourcesId(List<String> resourcesId) {
		this.resourcesId = resourcesId;
	}

	public boolean isOnline() {
		return online;
	}

	public void setOnline(boolean online) {
		this.online = online;
	}

	public boolean isAssigned() {
		return assigned;
	}

	public void setAssigned(boolean assigned) {
		this.assigned = assigned;
	}

	public Company getCompany() {
		return company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}

	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}
		
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
}
